package com.zb.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zb.entity.ZjWorkRemarkAnnex;
import com.zb.mapper.ZjWorkRemarkAnnexMapper;
import com.zb.service.ZjWorkRemarkAnnexService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 工单备注附件表 服务实现类
 * </p>
 *
 * @author WEN
 * @since 2024-04-02
 */
@Service
public class ZjWorkRemarkAnnexServiceImpl extends ServiceImpl<ZjWorkRemarkAnnexMapper, ZjWorkRemarkAnnex> implements ZjWorkRemarkAnnexService {

    // 根据工单备注ID获取工单备注附件
    @Override
    public List<ZjWorkRemarkAnnex> getByWorkRemarkIds(List<Long> workRemarkIds) {
        if (CollectionUtil.isEmpty(workRemarkIds)) {
            return new ArrayList<>();
        }
        QueryWrapper<ZjWorkRemarkAnnex> wrapper = new QueryWrapper<>();
        wrapper.select("id", "work_remark_id", "path")
                .in("work_remark_id", workRemarkIds);
        return this.list(wrapper);
    }
}
